package com.uinnova.product.eam.service;

import com.alibaba.fastjson.JSONObject;
import com.uino.bean.permission.business.UserInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @description: 单点登录接口
 * @author: LiMG
 * @create: 2024-05-28 11:30:55
 **/
public interface CasLoginService {

    /**
     * 获取要跳转的国投登录页面地址
     * @return
     */
    String getJumpLoginUrl();

    /**
     * 获取要跳转的国投登出页面地址
     * @return
     */
    String getJumpLogoutUrl();

    /**
     * 校验登录票据有效性
     * @param ticket
     * @param goPageUrl
     * @return
     */
    void checkLoginTicket(String ticket, String goPageUrl, HttpServletRequest request, HttpServletResponse response) throws IOException;

    /**
     * 票据登出
     * @param ticket
     * @param type
     * @param response
     */
    void ticketLogout(String ticket, Integer type, HttpServletResponse response) throws IOException;

    /**
     * 根据权限码获取用户信息
     * @param authorization
     * @return
     */
    Object getUser(String authorization);

    /**
     * 设置用户信息缓存
     * @param userInfo
     * @param authorization
     */
    void setUser(UserInfo userInfo, String authorization);

    /**
     * 获取用户信息
     * @param ticket
     * @return
     */
    JSONObject getUserInfo(String ticket);

}
